/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.fpt.stub;

import edu.fpt.bean.StudentLocalHome;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.CreateException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author Admin
 */
public class StudentEntityStub {
    public void insert(String studentId, String name, String password) throws Exception{
        StudentLocalHome home = lookupStudentLocal();
        home.create(studentId, name, password);
    }
    private StudentLocalHome lookupStudentLocal() {
        try {
            Context c = new InitialContext();
            StudentLocalHome rv = (StudentLocalHome) c.lookup("java:comp/env/Student");
            return rv;
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }
    
}
